package com.dz.time;

import org.apache.flink.api.common.functions.AggregateFunction;
import time.pproduct.Products;

/**
 * @ClassName MyCountAggregate
 * @Description TODO
 * @Author zhangdong
 * @Date 2020/11/29 21:39
 * @Version 1.0
 */
public class MyCountAggregate implements AggregateFunction<Products,Long,Long> {
    @Override
    public Long createAccumulator() {
        return 0L;
    }

    @Override
    public Long add(Products value, Long accumulator) {
        return accumulator+1;
    }

    @Override
    public Long getResult(Long accumulator) {
        return accumulator;
    }

    @Override
    public Long merge(Long a, Long b) {
        return a+b;
    }
}
